﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace UnityEngine
{
    public static class FormatedDebuggerLogger
    {
        public static void LogDemarcation(string infor) =>
            Debug.Log("[---------" + infor +"---------]");

        public static void Log(string infor, params string[] debugTitle) =>
            Debug.Log(GetFormatedInfor(debugTitle, infor));

        public static void LogError(string infor, params string[] debugTitle) =>
            Debug.LogError(GetFormatedInfor(debugTitle, infor));

        public static void LogWarning(string infor,params string[] debugTitle) =>
            Debug.LogWarning(GetFormatedInfor(debugTitle,infor));

        private static string GetFormatedInfor(string[] debugTitle, string infor)
        {
            var title = GetTitleByArray(debugTitle);
            title += "-----" + infor;
            return title;
        }

        private static string GetTitleByArray(string[] debugTitle){

            if (debugTitle.Length == 0)
                return "[Default]";

            var title = "";
            title += '[' + debugTitle[0];

            for (int i = 1; i < debugTitle.Length; i++)
                title += '-'+ debugTitle[i];

            title += ']';

            return title;
        }
    }
}